﻿namespace zlhis_restful.Common
{
    using Microsoft.Extensions.Configuration;
    using System.IO;

    /// <summary>
    /// Defines the <see cref="AppSettings" />.
    /// </summary>
    public class AppSettings
    {
        /// <summary>
        /// 获取配置文件.
        /// </summary>
        /// <param name="key">.</param>
        /// <returns>.</returns>
        public static string GetAppSeting(string key)
        {
            var configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json").Build();

            if (configuration.GetSection("Jwt")[key] != null)
            {
                return configuration.GetSection("Jwt")[key];
            }
            else
            {
                return null;
            }
        }
    }
}
